﻿// See https://aka.ms/new-console-template for more information
using DataAlgorithm.二叉树;

Console.WriteLine("开始啦！");

//二叉树遍历
//创建二叉树：
Console.WriteLine("start 创建二叉树");
TreeNode root = new TreeNode("A");
root.Left = new TreeNode("B");
root.Right = new TreeNode("C");
root.Left.Left = new TreeNode("D");
root.Left.Right = new TreeNode("E");
root.Right.Right = new TreeNode("F");

//遍历
//前序遍历
Console.WriteLine("前序遍历:");
BinaryDemo.PreOrderTraversal(root);

//中序遍历
Console.WriteLine("中序遍历:");
BinaryDemo.InOrderTraVeral(root);

//后序遍历
Console.WriteLine("后序遍历");
BinaryDemo.PostOrderTraVeral(root);

Console.WriteLine("end 遍历二叉树");
Console.ReadLine();



